package er;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class NumberThirteen {
    public static void main(String[] args) {
        try(
                FileInputStream fileInputStream=new FileInputStream("C:/Users/Administrator/Videos/test.mp4");
                FileOutputStream fileOutputStream1=new FileOutputStream("G:/file/qiege/sui1.txt");
                FileOutputStream fileOutputStream2=new FileOutputStream("G:/file/qiege/sui2.txt");
                FileOutputStream fileOutputStream3=new FileOutputStream("G:/file/qiege/sui3.txt");
                FileOutputStream fileOutputStream4=new FileOutputStream("G:/file/qiege/sui4.txt");
                ) {
            byte[] bytes=new byte[1048576];
            List<FileOutputStream> list=new ArrayList<>();
            list.add(fileOutputStream1);
            list.add(fileOutputStream2);
            list.add(fileOutputStream3);
            list.add(fileOutputStream4);
            while (true)
            {
                for (FileOutputStream fileOutputStream : list) {
                    int read=fileInputStream.read(bytes);
                    if (read!=-1){
                        fileOutputStream.write(bytes,0,read);
                    }else if (read==-1){
                        return;
                    }
                }
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
